package com.jinxin.platform.cdfaceacs.controller;

import com.jinxin.platform.base.common.pojo.JsonResult;
import com.jinxin.platform.cdfaceacs.pojo.dto.RuleDto;
import com.jinxin.platform.cdfaceacs.utils.RuleComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Date: 2021-04-23
 * Author: yangjie
 * desc:
 **/
@Api(tags = "配置接口")
@RestController
@RequestMapping(value = "/attendanceRecord/config")
public class ConfigController {
    @Resource
    RuleComponent ruleComponent;

    @ApiOperation(value = "获取考勤配置对象")
    @GetMapping(value = "/getConfig")
    public JsonResult getConfig() {
        return JsonResult.ok(ruleComponent.getConfig());
    }

    @ApiOperation(value = "设置考勤配置对象")
    @PostMapping(value = "/setConfig")
    public JsonResult setConfig(@RequestBody RuleDto configForm) {
        ruleComponent.setConfig(configForm);
        return JsonResult.ok(ruleComponent.getConfig());
    }
}
